package com.dongnao.network.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @author sjy
 * @date 2024年05月08日 18:26
 */
public class SocketClient {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 9999);
        OutputStream outputStream = socket.getOutputStream();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入：");
        String msg = scanner.nextLine() + "\r\n";
        outputStream.write(msg.getBytes());
        outputStream.flush();
        scanner.close();
        socket.close();
    }
}
